<?php
	function Imagepost__install() {
		global $sql, $group;
		$sql->query('CREATE TABLE IF NOT EXISTS `".$sql->prefix."postimgs` (
						`id` INT(11) NOT NULL AUTO_INCREMENT,
						`filename` VARCHAR(250) NOT NULL, 
						`title` VARCHAR(250) NOT NULL,
						`post_id` INT(11) NOT NULL,
						`align` INT(11) NOT NULL,
						`caption` VARCHAR(250)NOT NULL,
							PRIMARY KEY (`id`)
						) DEFAULT CHARSET=UTF8');
		$group->add_permission("add_post_image");
		$group->add_permission("edit_post_image");
		$group->add_permission("delete_post_image");
	}
	function Imagepost__uninstall($confirm) {
		global $sql, $group;
		
		if ($confirm == "true")
			$sql->query("DROP TABLE `".$sql->prefix."postimgs`");
			
			$group->remove_permission("add_post_image");
			$group->remove_permission("edit_post_image");
			$group->remove_permission("delete_post_image");
	}
	class Imagepost {
		function add_field_to_options() {
?>
					<p>
						<label for="images"><?php echo __("Upload Image:", "postimgs"); ?><span class="sub"> <?php echo __("(optional)", "postimgs"); ?></span></label> 
						<div id="uploader">
							<div id="iframe_container">
									<iframe src="MODULES_DIR/postimgs/pages/uploader.php" frameborder="0"></iframe>
							</div>
							<div id="images_container">
							</div>
						</div>
					</p>
<?php
		}
	}
	
?>